import * as types from './recommendMutationTypes';
//import arrayUtil from '../../../common/arrayUtil';
// import assignDeep from 'assign-deep';

/**
 * mutations
 * @type {{}}
 */
const mutations = {

  [types.SYS_RECOMMENDS_UPLOAD_QUERY_TOKEN](state) {
  },
  [types.SYS_RECOMMENDS_UPLOAD_SAVE_FILE_BEGIN](state) {
  },
  [types.SYS_RECOMMENDS_UPLOAD_SAVE_FILE_SUC](state, {newdata}) {
  },
  [types.SYS_RECOMMENDS_UPLOAD_UPDATE_SUC](state, {fundCode}) {

    if (fundCode === '-1') {
      for (var i = 0; i < state.Recommends.length; i++) {
        state.Recommends[i].state = '0'
      }
    } else {
      for (var j = 0; j < state.Recommends.length; j++) {
        if (state.Recommends[j].fundCode === fundCode) {
          state.Recommends[j].state = '1'
        } else {
          state.Recommends[j].state = '0'
        }
      }
    }
  },
  [types.SYS_RECOMMENDS_UPLOAD_DELETE_SUC](state, {id}) {

  },
  [types.SYS_FILE_UPLOAD_QUERY_RECOMMENDS_BEGIN](state) {
    state.Recommends = [];
  },
  [types.SYS_FILE_UPLOAD_QUERY_RECOMMENDS_SUC](state, {Recommends}) {
    state.Recommends = Recommends || [];
  }

};

export default mutations;
